package com.tao.mytestsocket.http.control;


import com.tao.mytestsocket.NetUtils;
import com.tao.mytestsocket.http.MsgCache;
import com.tao.utilslib.log.LogUtil;
import com.yanzhenjie.andserver.annotation.Controller;
import com.yanzhenjie.andserver.annotation.GetMapping;
import com.yanzhenjie.andserver.annotation.PostMapping;
import com.yanzhenjie.andserver.annotation.RequestMapping;
import com.yanzhenjie.andserver.annotation.RequestParam;
import com.yanzhenjie.andserver.annotation.RestController;
import com.yanzhenjie.andserver.http.HttpRequest;
import com.yanzhenjie.andserver.http.HttpResponse;
import com.yanzhenjie.andserver.util.MediaType;

/**
 * reate by tao on{DATE}
 */


@RestController
public class LocalController {
    @PostMapping(path = "/msg", produces = MediaType.ALL_VALUE)
    public String msg( @RequestParam(name = "msg") String msg ,@RequestParam(name = "msgId") String msgId) {
    
        MsgCache.INSTANCE.putMsg(msg);
      
        return "服务端："+  NetUtils.getLocalIPAddress().getHostName()+" 收到数据请求 消息Id:" + msgId +" 数据长度："+(msg==null? 0:msg.length()) +" 数据内容：{"+ msg +"}";
    }

}
